﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bio7
{
    /// <summary>
    /// Represents oligonucleotide
    /// </summary>
    public class Olig
    {
        public string Sequence { get; private set; }

        public Olig(string sequence)
        {
            Sequence = sequence;
        }

        public int Distance(Olig olig)
        {
            for (var i = 1; i < Sequence.Length; i++)
            {
                var ok = true;
                var count = 0;
                for (var j = i; j < this.Sequence.Length; j++)
                {
                    if (Sequence[j] != olig.Sequence[j - i])
                    {
                        ok = false;
                        break;
                    }
                    count++;
                }
                if (ok && count != olig.Sequence.Length)
                {
                    return i;
                }
            }
            return Sequence.Length;
        }
    }
}